<!DOCTYPE html>
<html>
<head>
    {% include 'zbook/common/header.html' %}
    <title>搜索</title>
</head>

<body>
{% include 'zbook/common/topbar.html' %}
<!--搜索结果-->
<div class="container">
    <!--推荐书籍-->
    {% include 'zbook/common/recommend.html' %}
    <!--搜索内容-->
    <div class="search-content">
        {% for p in data.hits %}
        <div class="search-result clearfix">
            <div class="search-result-img">
                {% if p.book.img %}
                <img src="{{ p.book.img }}" class="img">
                {% else %}
                <img src="/_uploads/photos/default_img.png" class="img">
                {% endif %}
            </div>
            <div class=" search-result-info">
                <h4><a href="/read?bid={{p.bid}}&pid={{p.sort}}&key={{data.query}}">《{{ p.book.name }}》 / 第{{p.sort}}章
                    {{p.title|safe}}</a></h4>
                <div class="clearfix">
                    <p class="col-sm-12 col-md-6 col-xs-12">作者：{{ p.book.auth }}</p>
                    <p class="col-sm-12 col-md-6 col-xs-12">章节：共 {{ p.book.sheets }} 章</p>
                    <p class="col-sm-12 col-md-6 col-xs-12">阅读：{{ p.book.views }}</p>
                    <p class="col-sm-12 col-md-6 col-xs-12">笔记：{{ p.book.notes }}</p>
                </div>
                <div class="search-summary">{{ p.content|safe }}</div>
                <div class="read-operate">
                    <a href="#" class="btn btn-default">收藏</a>
                    <a href="/read?bid={{p.bid}}&pid={{p.sort}}&key={{data.query}}" class="btn btn-info">阅读</a>
                </div>
            </div>
        </div>
        {% endfor %}
    </div>
    <div aria-label="Page navigation">
        <ul class="pagination navbar-right">
            {% for pn in data.page_navs %}
                {% if pn.name == "first" %}
                    <li><a href="{{pn.href}}" aria-label="Previous"><span aria-hidden="true">&laquo;</span> </a></li>
                {% elif pn.name == "last" %}
                    <li><a href="{{pn.href}}" aria-label="Next"><span aria-hidden="true">&raquo;</span> </a></li>
                {% else %}
                    {% if pn.current %}
                        <li class="disabled"><a href="#">{{ pn.name }}</a></li>
                    {% else %}
                        <li class=""><a href="{{pn.href}}">{{ pn.name }}</a></li>
                    {% endif %}
                {% endif %}
            {% endfor %}

        </ul>
    </div>
</div>
{% include 'zbook/common/footer.html' %}
</body>
</html>
<script>
	var topnode = document.querySelector('#header-top');

	function change() {
		var bgheader = document.getElementById('integral-bgheader');
		var y = document.scrollingElement.scrollTop;
		bgheader.style.opacity = (((y / 50) > 0.9) ? 0.9 : (y / 50));
		if(y > 50) {
			topnode.classList.add("headerstyle");
		} else {
			topnode.classList.remove("headerstyle");
		}
	}
	document.addEventListener('touchmove', change);
	document.addEventListener('scroll', change);
	/**************搜索********************/
	function submit_search(){
		var name= $("#search-content").val();
		if(name!=''){
			window.location.href='/search?key='+name;
		}else{
			PromptBox('请输入查询信息!',2,false);
		}

	}


</script>